package com.ruoyi.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysAppPrescriptionSort;
import com.ruoyi.system.mapper.SysAppPrescriptionSortMapper;
import com.ruoyi.system.service.ISysAppPrescriptionSortService;

/**
 * 方剂分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-09-04
 */
@Service
public class SysAppPrescriptionSortServiceImpl implements ISysAppPrescriptionSortService {
	@Autowired
	private SysAppPrescriptionSortMapper sysAppPrescriptionSortMapper;

	/**
	 * 查询方剂分类
	 * 
	 * @param id 方剂分类ID
	 * @return 方剂分类
	 */
	@Override
	public SysAppPrescriptionSort selectSysAppPrescriptionSortById(Long id) {
		return sysAppPrescriptionSortMapper.selectSysAppPrescriptionSortById(id);
	}

	/**
	 * 查询方剂分类列表
	 * 
	 * @param sysAppPrescriptionSort 方剂分类
	 * @return 方剂分类
	 */
	@Override
	public List<SysAppPrescriptionSort> selectSysAppPrescriptionSortList(
			SysAppPrescriptionSort sysAppPrescriptionSort) {
		return sysAppPrescriptionSortMapper.selectSysAppPrescriptionSortList(sysAppPrescriptionSort);
	}

	/**
	 * 新增方剂分类
	 * 
	 * @param sysAppPrescriptionSort 方剂分类
	 * @return 结果
	 */
	@Override
	public int insertSysAppPrescriptionSort(SysAppPrescriptionSort sysAppPrescriptionSort) {

		sysAppPrescriptionSort.setCreateDate(DateUtils.getNowDate());
		return sysAppPrescriptionSortMapper.insertSysAppPrescriptionSort(sysAppPrescriptionSort);
	}

	/**
	 * 修改方剂分类
	 * 
	 * @param sysAppPrescriptionSort 方剂分类
	 * @return 结果
	 */
	@Override
	public int updateSysAppPrescriptionSort(SysAppPrescriptionSort sysAppPrescriptionSort) {
		return sysAppPrescriptionSortMapper.updateSysAppPrescriptionSort(sysAppPrescriptionSort);
	}

	/**
	 * 删除方剂分类对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptionSortByIds(String ids) {
		return sysAppPrescriptionSortMapper.deleteSysAppPrescriptionSortByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除方剂分类信息
	 * 
	 * @param id 方剂分类ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptionSortById(Long id) {
		return sysAppPrescriptionSortMapper.deleteSysAppPrescriptionSortById(id);
	}

	@Override
	public List<SysAppPrescriptionSort> selectSortByInfoId(Long infoId) {
		List<SysAppPrescriptionSort> infos = sysAppPrescriptionSortMapper.selectSortByInfoId(infoId);
		return infos;
	}



}
